<!DOCTYPE html>
<html lang="zxx" class="js" xmlns:th="http://www.thymeleaf.org">

<head>
    <base href="../../../">
    <meta charset="utf-8">
    <meta name="author" content="Softnio">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="A powerful and conceptual apps base dashboard template that especially build for developers and programmers.">
    <!-- Fav Icon  -->
    <link rel="shortcut icon" href="./images/favicon.png" th:href="@{/images/favicon.png}">
    <!-- Page Title  -->
    <title>登录</title>
    <!-- StyleSheets  -->
    <link rel="stylesheet" href="./assets/css/dashlite.css?ver=2.2.0" th:href="@{/css/dashlite.css}">
    <link id="skin-default" rel="stylesheet" href="./assets/css/theme.css?ver=2.2.0" th:href="@{/css/theme.css}">
</head>

<body class="nk-body bg-white npc-general pg-auth">
    <div class="nk-app-root">
        <!-- main @s -->
        <div class="nk-main ">
            <!-- wrap @s -->
            <div class="nk-wrap nk-wrap-nosidebar">
                <!-- content @s -->
                <div class="nk-content ">
                    <div class="nk-block nk-block-middle nk-auth-body  wide-xs">
                        <div class="brand-logo pb-4 text-center">
                            <a href="html/index.html" class="logo-link">
                                <img class="logo-light logo-img logo-img-lg" th:src="@{/images/logo.png}" src="./images/logo.png" srcset="./images/logo2x.png 2x" alt="logo">
                                <img class="logo-dark logo-img logo-img-lg" th:src="@{/images/logo-dark.png}" src="./images/logo-dark.png" srcset="./images/logo-dark2x.png 2x" alt="logo-dark">
                            </a>
                        </div>
                        <div class="card card-bordered">
                            <div class="card-inner card-inner-lg">
                                <div class="nk-block-head">
                                    <div class="nk-block-head-content">
                                        <h4 class="nk-block-title">登录</h4>
                                        <div class="nk-block-des">
                                            <p>请输入用户名和密码.</p>
                                        </div>
                                    </div>
                                </div>
                                <form>
                                    <div class="form-group">
                                        <div class="form-label-group">
                                            <label class="form-label" for="username">用户名</label>
                                        </div>
                                        <input type="text" class="form-control form-control-lg" id="username" placeholder="请输入用户名">
                                    </div>
                                    <div class="form-group">
                                        <div class="form-label-group">
                                            <label class="form-label" for="password">密码</label>
                                            <a class="link link-primary link-sm" href="html/pages/auths/auth-reset-v2.html">忘记密码?</a>
                                        </div>
                                        <div class="form-control-wrap">
                                            <a href="#" class="form-icon form-icon-right passcode-switch" data-target="password">
                                                <em class="passcode-icon icon-show icon ni ni-eye"></em>
                                                <em class="passcode-icon icon-hide icon ni ni-eye-off"></em>
                                            </a>
                                            <input type="password" class="form-control form-control-lg" id="password" placeholder="请输入密码">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <button class="btn btn-lg btn-primary btn-block" onclick="userLogin()">登录</button>
                                    </div>
                                </form>
                                <div class="form-note-s2 text-center pt-4">还没有账号? <a href="html/pages/auths/auth-register-v2.html">注册一个</a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="nk-footer nk-auth-footer-full">
                        <div class="container wide-lg">
                            <div class="row g-3">
                                <div class="col-lg-6 order-lg-last">
                                    <ul class="nav nav-sm justify-content-center justify-content-lg-end">
                                        <li class="nav-item">
                                            <a class="nav-link" href="#">条款&条件</a>
                                        </li>
                                        <li class="nav-item">
                                            <a class="nav-link" href="#">隐私政策</a>
                                        </li>
                                        <li class="nav-item">
                                            <a class="nav-link" href="#">帮助</a>
                                        </li>
                                    </ul>
                                </div>
                                <div class="col-lg-6">
                                    <div class="nk-block-content text-center text-lg-left">
                                        <p class="text-soft">&copy; 2021 CryptoLite. All Rights Reserved.</p>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- wrap @e -->
            </div>
            <!-- content @e -->
        </div>
        <!-- main @e -->
    </div>
    <!-- app-root @e -->
    <!-- JavaScript -->
    <script src="./assets/js/bundle.js?ver=2.2.0" th:src="@{/js/bundle.js}"></script>
    <script src="./assets/js/scripts.js?ver=2.2.0" th:src="@{/js/scripts.js}"></script>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
    <script type="text/javascript">
        function userLogin(){
            var username = $("#username").val();
            var password = $("#password").val();

            if(username == ''){
                alert("用户名不能为空")
            }else if(password == ""){
                alert("密码不能为空")
            }else {
                $.post(
                    "login/userLogin",
                    "username="+username+"&password=" + password,
                    function (data){
                        var da = data.split(":");
                        if(da[0] == "success"){
                            location.href="/index/index?id=" + da[1];
                        }else{
                            alert("用户名或密码错误");
                        }
                    }
                )
            }
        }
    </script>
</html>